<?php
class Controller extends CController{
    public $layout = 'main';
    public $breadcrumbs = array();
    public $menu = array();

    public $activeMenu = 'dashboard';

    public $newEmailCount = 0;

    public function __construct($id, $module = null) {
        parent::__construct($id, $module);

        if(user()->isGuest){
            //login!
            $this->redirect(array('/site/login'));
        }

        //check access role

        //check new emails
        $this->newEmailCount = db()->createCommand()
                ->select('COUNT(*)')
                ->from('{{contact_us}}')
                ->where('readed=0')
                ->queryScalar();

        //register jquery corescript
        //$cs = Yii::app()->getClientScript();
        //$cs->registerCoreScript('jquery');
        //$cs->registerCoreScript('jqueryui');
    }
}